﻿namespace Mercury.ParticleEngine.EmitterShapes
{
    using System;

    public class BoxShape : IEmitterShape
    {
        public Single Width { get; set; }

        public Single Height { get; set; }

        public Single Depth { get; set; }

        public ShapeResult GetOffsetAndDirection()
        {
            var x = ExtensibilityPoints.RandomGenerator.NextSingle(-Width / 2f, Width / 2f);
            var y = ExtensibilityPoints.RandomGenerator.NextSingle(-Height / 2f, Height / 2f);
            var z = ExtensibilityPoints.RandomGenerator.NextSingle(-Depth / 2f, Depth / 2f);

            var offset = new Coordinate(x, y, z);

            var direction = ExtensibilityPoints.RandomGenerator.NextAxis();

            return new ShapeResult(offset, direction);
        }
    }
}